home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_348 / ilbmlib / remarks < prev    next >
Text File  |  1992-05-06  |  7KB  |  116 lines

  1.             "iffparse.library"
  2.                    VS
  3.             The dissidents "ilbm.library"
  4.  
  5.     Leo Schwab has written a library, called "iffparse.library", which can be
  6. used by any application to aid in the loading or saving of IFF files.  The
  7. dissidents' "ilbm.library" has similiar goals, but the implementation is
  8. somewhat different.  This document is meant to point out the differences
  9. between the two libraries so that a developer can choose which one best suits
  10. his needs.
  11.     Although the dissidents library has been written completely in assem-
  12. bly language for speed, and the high/mid level functions are original,
  13. this library is modeled after the Electronic Arts IFF code.  This means
  14. that it properly handles ILBM CATs, LISTs, and FORMs in a manner compatible
  15. with the most popular Amiga graphics program, DeluxePaint.  To date, it has
  16. been tested with a variety of picture files including HAM, Hires, Lores,
  17. Interlace, Compressed and UnCompressed, and ANIM files.  It has also been
  18. tested with files containing PROPs.  Although the library has many helpful
  19. features geared toward ILBM and ANIM files, it can be used for any type of IFF
  20. reader/writer (i.e. SMUS, 8SVX, SAMP, etc).  In fact, an example program,
  21. Play8SVX.c, shows non-ILBM use.  Furthermore, since the low level routines (i.e
  22. WriteIFFBytes, OpenIFF, etc) are functionally identical to the EA code, it is
  23. very easy to adapt any code written with the original EA functions to use this
  24. library.  It is fully re-entrant and about 7K in size.
  25.     The iffparse library uses a different parsing method than the EA code.
  26. It also can handle PROPs, LISTs, and CATs, but the example programs do not
  27. deal with ANIMs.  (The ANIM spec is a slightly deviated IFF FORM). I assume
  28. that the library won't choke on ANIMs but this is unconfirmed.  Otherwise, it
  29. is a very general IFF parser, not particularly baised toward any specific form.
  30. Consequently, it doesn't have those extra ILBM/ANIM perks that the ilbm
  31. library has (such as the ability to automatically decompress and scale an image
  32. into your open window/screen, or open a proper size window/screen for you).
  33. It has a completely different set of functions from the EA code, and so any
  34. application written with EA code will have to be modified quite a bit.  Leo's
  35. output (write) routines seem to hinge specifically on 3 functions: PushChunk(),
  36. WriteChunkBytes(), and PopChunk().  By passing 2 IDs, or 1 ID and a 0, Push-
  37. Chunk and PopChunk can start/stop both Groups and SubGroups.  With the ilbm
  38. library, there are separate start/stop functions for Groups and SubGroups.  I
  39. like his Pop and Push "approach" better the original EA method, but essential-
  40. ly, the libraries are very similiar in the complexity of the write routines. 
  41. Both require 3 separate functions to write a Group and/or sub Group ID, the
  42. data bytes, and then end the Group/Context.  Both libraries take care of
  43. allocating/freeing internal structures for each Group/Context, and pad out odd
  44. size chunks.  One feature that iffparse does have is the option of buffered
  45. read/write.  This can result in much faster loading and saving of data, but of
  46. course, at the expense of requiring more memory to implement.  If you're
  47. writing an application that has to run on a 512K machine, multi-task, and deals
  48. with large files (i.e. ANIMs or several ILBMs), then you probably won't be able
  49. to take advantage of the buffered I/O.  The iffparse lib is undoubtably re-
  50. entrant and is 8K in size, slightly larger than ilbm lib.
  51.     As mentioned, for ILBMs or ANIMs, the ilbm lib can completely take care
  52. of many details (such as PROPS, LISTS, and CATS) in a completely invisible
  53. manner to your application, placing all of the info in one "ILBMFrame" which
  54. you initially allocate.  That ILBMFrame's values always reflect the values of
  55. the current group, and you can reference it at various points.  The philoso-
  56. phy is:
  57.  
  58.     1). You open an IFF file and call a library routine to read/write it,
  59.     passing an ILBMFrame structure.
  60.  
  61.     2). The library parses through the file, calling your specified
  62.     routines whenever it encounters something that you want to handle, or
  63.     it doesn't understand (i.e. an 8SVX VHDR chunk).  Otherwise, the
  64.     library handles ILBMs and ANIMs.  For an ILBM, it can even load the
  65.     image into a specified window, automatically scaled, if you wish.
  66.     For saving, it can automatically write the BMHD, CMAP, CAMG, and
  67.     BODY completely on its own.
  68.  
  69.     3). Control returns to you when the file is loaded/saved.
  70.  
  71. With the iffparse.library, the philosophy is:
  72.  
  73.     1). You allocate an initial structure, open the file in buffered or
  74.     unbuffered mode, and call a routine to determine its initial Group
  75.     ID.
  76.  
  77.     2). You tell the library when to revert control back to you, and call
  78.     its parsing routine.
  79.  
  80.     3). When the library reverts control back, you analyse the return and
  81.     then must either do something with the data, or abort the parsing.
  82.  
  83.     4). You call the parsing routine again if you need to parse more of the
  84.     file.
  85.  
  86. Essentially, ilbm lib is the master and only calls you under the circumstances
  87. you initially specify.  IffParse is the slave, and reverts control back to you
  88. under the circumstances you initially specify.
  89.     Since both libs have the same level of complexity in the read/write
  90. routines, it's a toss-up which one you might use for IFF forms other than ANIM
  91. and ILBM.  Both are going to involve numerous calls to lib routines.  If your
  92. main interest is fast loads/saves, try IffParse lib.  For large data files that
  93. have to live in tight memory constraints, try ilbm lib.  For ILBMs or ANIMs,
  94. dissidents ilbm.library has many more features.  It even has several high level
  95. functions which make it possible to save or load a screen's bitmap as an IFF
  96. ILBM file via a single lib call. These high level functions make it possible to
  97. easily use the lib with interpreted languages such as Basic and Rexx. There is
  98. even an AmigaBasic "ScreenSave" and "IlbmViewer" example.  If all you need to
  99. do with IFF is save or load a picture, then ilbm lib is the answer.
  100.     Because the ilbm library always takes care of LISTs and CATs (at the
  101. high and mid levels), if you want to be able to read these kinds of files, then
  102. the ilbm library should be easier for you to use.  Also, if you've already
  103. struggled through the EA code, you'll recognize some familiar function names.
  104.     Both libs come with documentation, examples, and C and Asm Include
  105. files. Iffparse has no assembly or BASIC examples. I do not believe that it
  106. would be easy to use from BASIC. Ilbm lib has more assembly, and an AmigaBasic
  107. example.  Ilbm lib is free.  I don't believe that you can freely distribute the
  108. Iffparse library with your product.
  109.     Obviously, dissidents has been using ilbm.library in its products, and
  110. we hope to find time to augment the number of source examples for it. Bug
  111. fixes are definitely forthcoming if we ever find something wrong with it. (So
  112. far, everything works.)  The one problem that has been noted and corrected is
  113. that the C support file ILBMInterface.asm did not work with Lattice. The new
  114. file corrects that problem.  Try the library out, and if you have questions,
  115. contact us.
  116.